
/*
 * Copyright (C) 2009 Archie L. Cobbs. All rights reserved.
 *
 * $Id: XMLAtomicField.java 377 2010-03-11 20:50:18Z archie.cobbs $
 */

package org.dellroad.sidekar.xml;

import org.dellroad.sidekar.AtomicField;

/**
 * Container for a {@link AtomicField}'s value during the Sidekar XML import/export process.
 */
abstract class XMLAtomicField<T> extends XMLSimpleField<T> {

    // Used during unmarshalling
    protected XMLAtomicField(XMLItem xmlItem) {
        super(xmlItem);
    }

    // Used during unmarshalling
    protected XMLAtomicField(XMLField xmlField) {
        super(xmlField);
    }

    // Used during marshalling
    public XMLAtomicField(String name) {
        super(name);
    }

    // Used during unmarshalling
    @Override
    protected <T2> void caseAtomicField(AtomicField<T2> field) {
        field.set(getItem(), field.cast(getObjectValue()));
    }
}

